<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>性生活恢复和避孕情况</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/page/weixin/questionnaire.css" />

<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/page/weixin/jweixin-1.0.0.js"></script>
</head>
<body>
<div data-role="page" id="page_questionnaire52">
<form id="frmqa52" method="post">
<input type="hidden" name="openId" value="${openId}">
<input type="hidden" id="batchNo" name="batchNo" value="${batchNo }">
<input type="hidden" name="questionnaireId" value="52">
<div data-role="content" id="questionnaire52">

	<div id="div_p">
	<h3>康复情况</h3>
	日前月经是否恢复?<br/>
	<input id="question_94_1_183" name="question_94_1" type="radio" value="183" >是<br/>
	<input id="question_94_1_184" name="question_94_1" type="radio" value="184" >否<br/>
	</div>

<div id="div_q">
	<h3>性生活恢复和避孕情况</h3>
	Q1流产后至今是否有过性生活?<br/>
	<input id="question_96_1_186" name="question_96_1" type="radio" value="186" onclick="showDivQuestion('question_96_1','106')">是<br/>
	<input id="question_96_1_187" name="question_96_1" type="radio" value="187" onclick="showDivQuestion('question_96_1','112')">否<br/>

	<div id="div_question_96_1_106" name="div_question_96_1_106" style="display: none">
	Q2你在性生活中是否采取避孕措施?<br/>
	<input id="question_106_1_236" name="question_106_1" type="radio" value="236" onclick="showDivQuestion('question_106_1','190')">是<br/>
	<input id="question_106_1_237" name="question_106_1" type="radio" value="237" onclick="showDivQuestion('question_106_1','105')">否<br/>
	</div>

	<div id="div_question_96_1_112" name="div_question_96_1_112" style="display: none">
	Q2若你恢复性生活， 是否会采取避孕措施？<br/>
	<input id="question_112_1_252" name="question_112_1" type="radio" value="252" onclick="showDivQuestion('question_106_1','190')">是<br/>
	<input id="question_112_1_253" name="question_112_1" type="radio" value="253" onclick="showDivQuestion('question_106_1','105')">否<br/>
	</div>

	<div id="div_question_106_1_190" name="div_question_106_1_190" style="display: none">
	Q3避孕时采取下列哪种避孕方式（若采取多种避孕方式，以哪种为主）?<br/>
	<input id="question_98_1_190" name="question_98_1" type="radio" value="190" onclick="showDivQuestion('question_98_1','100')">短效口服避孕药<br/>
	<input id="question_98_1_191" name="question_98_1" type="radio" value="191" onclick="showDivQuestion('question_98_1','101')">避孕套<br/>
	<input id="question_98_1_192" name="question_98_1" type="radio" value="192">绝育（男性、女性）<br/>
	<input id="question_98_1_193" name="question_98_1" type="radio" value="193">宫内节育器<br/>
	<input id="question_98_1_194" name="question_98_1" type="radio" value="194">皮下埋植剂<br/>
	<input id="question_98_1_195" name="question_98_1" type="radio" value="195" >紧急避孕药<br/>
	<input id="question_98_1_196" name="question_98_1" type="radio" value="196" >安全期<br/>
	<input id="question_98_1_197" name="question_98_1" type="radio" value="197" >体外排精<br/>
	<input id="question_98_1_198" name="question_98_1" type="radio" value="198" >避孕栓/膏/膜<br/>
	<input id="question_98_1_199" name="question_98_1" type="radio" value="199">避孕针<br/>
	</div>

	<div id="div_question_98_1_100" name="div_question_98_1_100" style="display: none">
	Q4是否坚持每天服药?<br/>
	<input id="question_100_1_208" name="question_100_1" type="radio" value="208" onclick="showDivQuestion('question_100_1','102')">是<br/>
	<input id="question_100_1_209" name="question_100_1" type="radio" value="209">有过遗漏<br/>
	</div>

	<div id="div_question_98_1_101" name="div_question_98_1_101" style="display: none">
	Q5是否每次性生活都使用避孕套？<br/>
	<input id="question_101_1_210" name="question_101_1" type="radio" value="210">是<br/>
	<input id="question_101_1_211" name="question_101_1" type="radio" value="211">否<br/>
	</div>

	<div id="div_question_106_1_105" name="div_question_106_1_105" style="display: none">
	Q9.为什么不避孕？<br/>
	<input id="question_105_1_227" name="question_105_1" type="radio" value="227">忘记<br/>
	<input id="question_105_1_228" name="question_105_1" type="radio" value="228">偶尔不用，不会怀孕<br/>
	<input id="question_105_1_229" name="question_105_1" type="radio" value="229">不知道怎么避孕<br/>
	<input id="question_105_1_230" name="question_105_1" type="radio" value="230">没有避孕药具<br/>
	<input id="question_105_1_231" name="question_105_1" type="radio" value="231">没有找到合适避孕方式<br/>
	<input id="question_105_1_232" name="question_105_1" type="radio" value="232">男伴不愿意使用<br/>
	<input id="question_105_1_233" name="question_105_1" type="radio" value="233">双方不愿意使用<br/>
	<input id="question_105_1_234" name="question_105_1" type="radio" value="234">避孕药具太贵<br/>
	<input id="question_105_1_235" name="question_105_1" type="radio" value="235">其他原因<br/>
	</div>
</div>
</div>
<br/>
<div align="center">
	<a class="ui-btn ui-shadow ui-btn-corner-all" href="javascript:void(0)" onclick="submitFrm()" >
		<span class="ui-btn-inner">
			<span class="ui-btn-text">提交</span>
		</span>
	</a>
</div>
</form>
</div>

<div data-role="page" id="question52_diagnosis">
	<div data-role="content" id="question52_diagnosis_content">
	</div>
</div>
<script type="text/javascript">
wx.config({
    debug: false, 
    appId: '${appId}', 
    timestamp: '${timestamp}', 
    nonceStr: '${nonceStr}', 
    signature: '${signature}',
    jsApiList: ['closeWindow'] 
});

wx.error(function(res){
});

//显示关联问题
function showDivQuestion(qiestionId,val)
{
	$("div[name^='div_"+qiestionId+"']").each(function(i){  
		  $(this).css("display","none");
		  $(this).find("input[type='radio'],input[type='checkbox']").each(function(){
			  $(this).prop("checked", false);
		  });
	}); 
	$("div[name='div_"+qiestionId+"_"+val+"']").each(function(i){  
		  $(this).css("display","block");
	}); 
}

//检查表单
function checkQuestionnaireFrm()
{
	var question_94_val=$("input[name='question_94_1']:checked").val();
	if(null==question_94_val||""==question_94_val||undefined==question_94_val)
	{
		alert("请选择日前月经是否恢复");
		return false;
	}
	
	var question_96_val=$("input[name='question_96_1']:checked").val();
	if(null==question_96_val||""==question_96_val||undefined==question_96_val)
	{
		alert("请选择流产后至今是否有过性生活");
		return false;
	}
	
	var question_112_val=$("input[name='question_112_1']:checked").val();
	if((question_96_val=="187")&&(null==question_112_val||""==question_112_val||undefined==question_112_val))
	{
		alert("请选择若你恢复性生活， 是否会采取避孕措施");
		return false;
	}
	
	var question_106_val=$("input[name='question_106_1']:checked").val();
	if((question_96_val=="186")&&(null==question_106_val||""==question_106_val||undefined==question_106_val))
	{
		alert("请选择你在性生活中是否采取避孕措施");
		return false;
	}

	var question_98_val=$("input[name='question_98_1']:checked").val();
	if((question_106_val=="236"||question_112_val=="252")&&(null==question_98_val||""==question_98_val||undefined==question_98_val))
	{
		alert("请选择避孕时采取下列哪种避孕方式");
		return false;
	}
	
	var question_100_val=$("input[name='question_100_1']:checked").val();
	if((question_98_val=="190")&&(null==question_100_val||""==question_100_val||undefined==question_100_val))
	{
		alert("请选择是否坚持每天服药");
		return false;
	}
	
	var question_101_val=$("input[name='question_101_1']:checked").val();
	if((question_98_val=="191")&&(null==question_101_val||""==question_101_val||undefined==question_101_val))
	{
		alert("请选择是否每次性生活都使用避孕套");
		return false;
	}
	
	var question_105_val=$("input[name='question_105_1']:checked").val();
	if((question_106_val=="237"||question_112_val=="253")&&(null==question_105_val||""==question_105_val||undefined==question_105_val))
	{
		alert("请选择为什么不避孕");
		return false;
	}
	
	return true;
}

//提交表单
function submitFrm()
{
	if(checkQuestionnaireFrm())
	{
		kuanrf.common.loading();
		$('#frmqa52').form('submit', {    
		    url:"${pageContext.request.contextPath}/weixin/qusetionnaire/answer",    
		    onSubmit: function(){     
		    },    
		    success:function(jsontext){   
		    	var data=JSON.parse(jsontext);
		    	if(data.result==true)
	        	{
		    		alert(data.diagnosis);
		    		wx.closeWindow();
	        	}    
		    	else
		    	{
		    		alert(data.msg);
		    	}
		    }    
		});  
	}
}

</script>
</body>
</html>